<script setup>
import {ref} from "vue";

const info = ref('222')
const user = ref({
  name: '',
  age: '',
  password: '',
  gender: ''}
)
const reg = () => {
  console.log(user.value,user.value.name,user.value.age,user.value.password,user.value.gender)
}
</script>

<template>
<h1>双向绑定指令</h1>
<input type="text" v-model="info">
  {{info}}
  <hr>
  <input type="text" v-model="user.name" placeholder="please input your username">
  <input type="text" v-model="user.age" placeholder="please input your age">
  <input type="text" v-model="user.password" placeholder="please input your password">
  <input type="radio" v-model="user.gender" name="gender" value="man">男
  <input type="radio" v-model="user.gender" name="gender" value="woman">女
  <button @click="reg">注册</button>
</template>

<style scoped>

</style>